package com.qf.courtesycard.grabtickets.controller;

import com.qf.courtesyard.domain.vo.ResultVo;
import com.qf.courtesycard.grabtickets.service.IUserforticketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author lx
 * @since 2023-03-10
 */
@RestController
@RequestMapping("/grabtickets")
@Slf4j
public class UserforticketController {

    @Autowired
    private IUserforticketService userforticketService;

    /**
     * 抢券
     *
     * @param name
     * @param phoneNum
     * @return
     */
    @RequestMapping("/rushTicket")
    public ResultVo rushTicket(String name, String phoneNum) throws Exception {
        log.debug("接受到的参数name={},phoneNum={}", name, phoneNum);
        String msg = userforticketService.rushTicket(name, phoneNum);
        ResultVo ok = ResultVo.ok();
        ok.put("msg", msg);

        return ok;
    }


}
